home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 5.9 KB | 205 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWIconSh.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWICONSH_H
- #include "FWIconSh.h"
- #endif
-
- #ifndef FWGC_H
- #include "FWGC.h"
- #endif
-
- #ifndef SLRENDER_H
- #include "SLRender.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWSTREAM_H
- #include "FWStream.h"
- #endif
-
- //========================================================================================
- // File scope definitions
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment FWGraphx_IconShape
- #endif
-
- //========================================================================================
- // class FW_CIconShape
- //========================================================================================
-
- FW_DEFINE_AUTO(FW_CIconShape)
- FW_DEFINE_CLASS_M1(FW_CIconShape, FW_CBoundedShape)
-
- // This class is archivable, but we provide the archiving implementation in a separate
- // translation unit in order to enable deadstripping of the archiving-related code
- // in parts that do not use archiving with this class.
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::FW_CIconShape
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape::FW_CIconShape(const FW_CIcon& Icon,
- const FW_CRect& rect,
- FW_RenderIconTransform transform,
- FW_RenderIconAlignment alignment) :
- FW_CBoundedShape(rect, FW_kFill, FW_kNormalInk, FW_kNormalStyle, FW_kNormalFont),
- fIcon(Icon),
- fTransform(transform),
- fAlignment(alignment)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::FW_CIconShape
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape::FW_CIconShape(const FW_CIconShape& other) :
- FW_CBoundedShape(other),
- fIcon(other.fIcon),
- fTransform(other.fTransform),
- fAlignment(other.fAlignment)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::FW_CIconShape
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape::FW_CIconShape(FW_CReadableStream& stream) :
- FW_CBoundedShape(stream)
- {
- stream >> fIcon;
- stream >> fTransform;
- stream >> fAlignment;
-
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::~FW_CIconShape
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape::~FW_CIconShape()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::operator=
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape& FW_CIconShape::operator=(const FW_CIconShape& other)
- {
- FW_CBoundedShape::operator=(other);
-
- fIcon = other.fIcon;
- fTransform = other.fTransform;
- fAlignment = other.fAlignment;
-
- return *this;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::Render
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::Render(FW_CGraphicContext& gc) const
- {
- FW_PrivRenderIcon(gc.GetEnvironment(),
- gc,
- fIcon,
- fRect,
- fTransform,
- fAlignment,
- GetRenderVerb());
- FW_FailOnEvError(gc.GetEnvironment());
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::Copy
- //----------------------------------------------------------------------------------------
-
- FW_CShape* FW_CIconShape::Copy() const
- {
- return FW_NEW(FW_CIconShape, (*this));
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::Flatten
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::Flatten(FW_CWritableStream& stream) const
- {
- FW_CBoundedShape::Flatten(stream);
-
- stream << fIcon;
- stream << fTransform;
- stream << fAlignment;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::RenderIcon
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::RenderIcon(FW_CGraphicContext& gc,
- const FW_CIcon& icon,
- const FW_CRect& rect,
- FW_RenderIconTransform transform,
- FW_RenderIconAlignment alignment)
- {
- FW_PrivRenderIcon(gc.GetEnvironment(),
- gc,
- icon,
- rect,
- transform,
- alignment,
- FW_kFill);
- FW_FailOnEvError(gc.GetEnvironment());
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::GetGeometry
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::GetGeometry(FW_CIcon& icon,
- FW_CRect& bounds,
- FW_RenderIconTransform& transform,
- FW_RenderIconAlignment& alignment) const
- {
- icon = fIcon;
- transform = fTransform;
- alignment = fAlignment;
- bounds = fRect;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::SetGeometry
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::SetGeometry(const FW_CIcon& icon,
- const FW_CRect& bounds,
- FW_RenderIconTransform transform,
- FW_RenderIconAlignment alignment)
- {
- fIcon = icon;
- fTransform = transform;
- fAlignment = alignment;
- fRect = bounds;
- }
-
-